<?php

namespace App\Policies;

use App\Blogs;
use App\User;
use Illuminate\Auth\Access\HandlesAuthorization;

class BlogsPolicy
{
    use HandlesAuthorization;

    /**
     * Create a new policy instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * 修改权限
     *
     * 1.创建Policy 》》 php artisan make:policy BolgsPolicy
     * 2.注册Policy 》》 在Providers下注册
     *
     */

    public function edit(User $user,Blogs $blogs)
    {

        return $blogs->user_id === $user->id;
    }


    /**
     *
     * 删除权限
     * @param User  $user
     * @param Blogs $blogs
     *
     * @return bool
     */
    public function delete(User $user,Blogs $blogs)
    {
        return $blogs->user_id === $user->id;
    }


}
